import Vue from 'vue'
import App from './App.vue'
//导入路由
import VueRouter from 'vue-router'
Vue.use(VueRouter)
import router from './routes/router'

import 'mint-ui/lib/style.css' //引入mint-ui样式
//导入mint-ui,按需导入
import {
  Header,
  Swipe,
  SwipeItem,
  Switch
} from 'mint-ui'
Vue.component(Header.name, Header) //按需导入时需要使用component注册成全局组件
Vue.component(Swipe.name, Swipe)
Vue.component(SwipeItem.name, SwipeItem)
Vue.component(Switch.name, Switch)

import VueResource from 'vue-resource' // 导入vue-resource
Vue.use(VueResource)
//设置请求的根路径
//Vue.http.options.root = "http://"+window.location.host.split(":")[0]+':3000'
Vue.http.options.root = 'https://elm.cangdu.org'
Vue.http.options.xhr = {
  //允许携带cookie  (仅get请求生效)
  withCredentials: true
}
Vue.http.options.emulateJSON = true
//允许post请求携带cookie
Vue.http.interceptors.push((request, next) => {
  request.credentials = true;
  next();
});

import 'lib/mui/css/mui.min.css' //引入mui的css样式
import 'lib/mui/css/icons-extra.css'

//导入bootstrap
import 'bootstrap/dist/css/bootstrap.css'

//引入自定义的全局css文件
import './css/index.css'

import 'lib/icon/iconfont.css'

Vue.config.productionTip = false

new Vue({
  render: h => h(App),
  router,
}).$mount('#app')